package com.lightboat.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lightboat.common.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lightboat.system.mapper.SysUserHierarchyMapper;
import com.lightboat.system.domain.SysUserHierarchy;
import com.lightboat.system.service.ISysUserHierarchyService;

/**
 * 用户上下级关系Service业务层处理
 * 
 * @author lightboat
 * @date 2025-08-14
 */
@Service
@RequiredArgsConstructor
public class SysUserHierarchyServiceImpl extends ServiceImpl<SysUserHierarchyMapper, SysUserHierarchy> implements ISysUserHierarchyService
{

    private final SysUserHierarchyMapper sysUserHierarchyMapper;

    /**
     * 查询用户上下级关系
     * 
     * @param id 用户上下级关系主键
     * @return 用户上下级关系
     */
    @Override
    public SysUserHierarchy selectSysUserHierarchyById(Long id)
    {
        return sysUserHierarchyMapper.selectSysUserHierarchyById(id);
    }

    /**
     * 查询用户上下级关系列表
     * 
     * @param sysUserHierarchy 用户上下级关系
     * @return 用户上下级关系
     */
    @Override
    public List<SysUserHierarchy> selectSysUserHierarchyList(SysUserHierarchy sysUserHierarchy)
    {
        return sysUserHierarchyMapper.selectSysUserHierarchyList(sysUserHierarchy);
    }

    /**
     * 新增用户上下级关系
     * 
     * @param sysUserHierarchy 用户上下级关系
     * @return 结果
     */
    @Override
    public int insertSysUserHierarchy(SysUserHierarchy sysUserHierarchy)
    {
        sysUserHierarchy.setCreateTime(DateUtils.getNowDate());
        return sysUserHierarchyMapper.insertSysUserHierarchy(sysUserHierarchy);
    }

    /**
     * 修改用户上下级关系
     * 
     * @param sysUserHierarchy 用户上下级关系
     * @return 结果
     */
    @Override
    public int updateSysUserHierarchy(SysUserHierarchy sysUserHierarchy)
    {
        sysUserHierarchy.setUpdateTime(DateUtils.getNowDate());
        return sysUserHierarchyMapper.updateSysUserHierarchy(sysUserHierarchy);
    }

    /**
     * 批量删除用户上下级关系
     * 
     * @param ids 需要删除的用户上下级关系主键
     * @return 结果
     */
    @Override
    public int deleteSysUserHierarchyByIds(Long[] ids)
    {
        return sysUserHierarchyMapper.deleteSysUserHierarchyByIds(ids);
    }

    /**
     * 删除用户上下级关系信息
     * 
     * @param id 用户上下级关系主键
     * @return 结果
     */
    @Override
    public int deleteSysUserHierarchyById(Long id)
    {
        return sysUserHierarchyMapper.deleteSysUserHierarchyById(id);
    }
}
